<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>5</title>
</head>
<body>
<script>
    //运用break结束当前的循环,计算1,2,3,4,5这一组数据,但要求只计算前三个数的和
    var sum=0;
    for (let i = 1; i <= 5; i++) {
        sum+=i;
        if (i==3){
            break;
        }
    }
    console.log("前三个数的和为:"+sum);
</script>
</body>
</html>